import random
import time

def heartBeat(client, logger):
    logger.info('心跳包服务已开启')

    while True:
        client.heartBeat()
        if not client.isLogin:
            logger.info('账号未处于登录状态, 已退出心跳')
            break
        time.sleep(random.randint(3, 6))
